﻿Module Module1

    Sub Main()
        Dim coefia, coefib, coefic As Decimal
        Dim result, result1 As Decimal
        Console.Title = "Ejercicio if condicional 6"
        Console.WriteLine("Introduce los coeficientes ")
        Console.Write("a : ")
        coefia = Console.ReadLine()
        Console.Write("b : ")
        coefib = Console.ReadLine()
        Console.Write("c : ")
        coefic = Console.ReadLine()
        If (coefib ^ 2 - 4 * coefia * coefic) > 0 Then
            result = (-1 * coefib + Math.Sqrt(coefib ^ 2 - 4 * coefia * coefic)) / (2 * coefia)
            result1 = (-1 * coefib - Math.Sqrt(coefib ^ 2 - 4 * coefia * coefic)) / (2 * coefia)
            Console.WriteLine("El resultado es x1 = " & result & " x2 = " & result1)
        ElseIf (coefib ^ 2 - 4 * coefia * coefic) = 0 Then
            result = (-1 * coefib + Math.Sqrt(coefib ^ 2 - 4 * coefia * coefic)) / (2 * coefia)
            Console.WriteLine("El resultado es x1 y x2 = " & result)
        ElseIf (coefib ^ 2 - 4 * coefia * coefic) < 0 Then
            Console.WriteLine("No se puede hacer")
        End If

        Console.ReadKey()
    End Sub

End Module
